package com.test.springboot_test.stringTest;

import java.util.Arrays;

public class SpringTest10 {

    public static void main(String[] args) {

        /**
         * 字符串基本操作
         * 分割、截取、拼接、索引、字母大小写转换
         */
        //分割
        String a = "1,2,3,4,5,6,7,8,9,10";
        String[] split = a.split(",");
        System.out.println(Arrays.asList(split).toString());

        //截取、索引
        String str = "1+1=@2";
        System.out.println(str.substring(0, str.lastIndexOf("@")));
        System.out.println(str.substring(str.lastIndexOf("@") + 1));

        //拼接
        String str1[] ={"1","2","a"};
        StringBuilder builder = new StringBuilder();
        for (String a1 : str1){
            builder.append(a1);
        }
        System.out.println(builder.toString());
    }

}
